<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>reg</title>
    <link rel="stylesheet" type="text/css" href="css2.css">
</head>
<body>
<h3 ><center>注册</center></h3>
</p>
<h2><p align="center">账号:
    <input id="uname" type="text" name="user" placeholder="请输入学工号"style="font-size:23px;width:200px;height:40px;"></h2>
</p>
<h2><p align="center">密码:
    <input id="pass" type="password" name="psw" placeholder="请输入密码"style="font-size:23px;width:200px;height:40px;"></h2>
</p>
<h2><p align="center">密码:
    <input id="upass" type="password" name="psw" placeholder="请确认密码"style="font-size:23px;width:200px;height:40px;"></h2>
</p>

<script>
    function myFunction()
    {
        var x=document.getElementById("uname").value;
        var y=document.getElementById("pass").value;
        var z=document.getElementById("upass").value;
        if(x==""||isNaN(x))
        {
            alert("学工号错误，请重新输入");
        }
        else if(y!=z)
            alert("前后输入密码不一致，请重新输入");
        else
            alert("注册成功，请返回首页登录");
    }
</script>

<center><button type="button" onclick="myFunction()"style="font-size:23px;width:100px;height:40px;">注册</button></center>

</body>
</html>